package com.sedshop.shop;/**
 * Created by Administrator on 2016/5/10.
 */

import android.app.Application;
import android.content.Context;

import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
import com.nostra13.universalimageloader.core.assist.QueueProcessingType;
import com.umeng.socialize.PlatformConfig;


/**
 * 作者：Administrator on 2016/5/10 09:34
 * 邮箱：314960314@qq.com
 */
public class AppApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        initLoader(this);
    }

    private void initLoader(Context context) {
        // This configuration tuning is custom. You can tune every option, you
        // may tune some of them,
        // or you can create default configuration by
        // ImageLoaderConfiguration.createDefault(this);
        // method.
        ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
                getApplicationContext())
                .threadPriority(Thread.NORM_PRIORITY - 2)
                .threadPoolSize(3)//线程池内加载的数量
                .denyCacheImageMultipleSizesInMemory()
                .diskCacheFileNameGenerator(new Md5FileNameGenerator())
                .diskCacheSize(50 * 1024 * 1024)
                        // 50 Mb
                .tasksProcessingOrder(QueueProcessingType.LIFO)
                .writeDebugLogs() // Remove for release app
                .build();
        // Initialize ImageLoader with configuration.
        ImageLoader.getInstance().init(config);
    }


    //各个平台的配置，建议放在全局Application或者程序入口
    {
    PlatformConfig.setWeixin("wx967daebe835fbeac", "5bb696d9ccd75a38c8a0bfe0675559b3");
    //微信 appid appsecret
    PlatformConfig.setSinaWeibo("3921700954", "04b48b094faeb16683c32669824ebdad");
    //新浪微博 appkey appsecret
    PlatformConfig.setQQZone("100424468", "c7394704798a158208a74ab60104f0ba");
    // QQ和Qzone appid appkey
    }
}
